package com.ykh.mybbsdemo.controller;

import com.ykh.mybbsdemo.service.SysUserService;
import com.ykh.mybbsdemo.vo.Result;
import org.apache.logging.log4j.util.PerformanceSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-08-31
 * Time: 10:41
 */
//获取用户信息
@RestController
@RequestMapping ("users")
public class UserController {
    @Autowired
    private SysUserService sysUserService;

    /**
     * 获取当前登录的用户信息
     * @param token
     * @return
     */
    @GetMapping("currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token) {
        return sysUserService.findUserInfoByToken(token);
    }
 }
